<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
   <article>
       <div id="div-01">here is div-01
           <div id="div-02">here is div-02
               <div id="div-04">here is div-04</div>
               <div id="div-03">here is div-03</div>
           </div>
       </div>
   </article>

   <script>
       // closest 找最近的父元素和本身
       var el = document.getElementById('div-03');
       console.log(el.closest('#div-02'));
       console.log(el.closest('div div'));
       console.log(el.closest('article > div'));
       console.log(el.closest(':not(div)'));
   </script>
</body>
</html>